package club.ruanx.movie.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;
import java.util.Date;

/**
 * @author 阮胜
 * @date 2018/10/21 18:45
 */
@Data
@Entity
@Builder
@DynamicUpdate
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "t_movie")
public class Movie {
    private static final long serialVersionUID = -8154160345912410818L;

    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    @Column(length = 36)
    private String id;
    /**
     * 电影名
     */
    @Column(length = 36)
    private String name;

    /**
     * 评分
     */
    private Float rate;

    /**
     * 封面
     */
    @Column(length = 128)
    private String cover;


    /**
     * 导演
     */
    @Column(length = 1024)
    private String directors;

    /**
     * 主演
     */
    @Column(length = 1024)
    private String actors;

    /**
     * 类型
     */
    @Column(length = 128)
    private String types;

    /**
     * 上映日期
     */
    private Date initialReleaseDate;

    /**
     * 语言
     */
    @Column(length = 128)
    private String languages;

    /**
     * 上映地区 内地,香港,美国等
     */
    @Column(length = 128)
    private String areas;

    /**
     * 片长
     */
    @Column(length = 16)
    private String duration;

    /**
     * 简介
     */
    @Column(columnDefinition = "TEXT")
    private String introduction;

    /**
     * 宣传视频
     */
    @Column(length = 128)
    private String video;

    /**
     * 别名
     */
    @Column(length = 128)
    private String aka;

    /**
     * 爬虫ID
     */
    @Column(length = 36)
    private String spiderId;

    /**
     * 剧照
     */
    @Column(columnDefinition = "TEXT")
    private String photos;

    @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
    private Date updateTime;

    @Temporal(TemporalType.TIMESTAMP)
    @UpdateTimestamp
    @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
    private Date createTime;

}
